package com.example.juc.kkb.printab;

public class PrintByLock {

    public static void main(String[] args) {

        MyCondition4 myCondition4 = new MyCondition4();

        new Thread(() -> {
            for (int i = 0; i < 10; i++) {
                try {
                    myCondition4.printA();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }, "线程1").start();

        new Thread(() -> {
            for (int i = 0; i < 10; i++) {
                try {
                    myCondition4.printB();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }, "线程2").start();

    }
}
